﻿#ifndef PST_DIALOGHEATGRAPH2DSETTINGS_H
#define PST_DIALOGHEATGRAPH2DSETTINGS_H

#include <IdaDialogFrame>
#include "InfomationCurve2DBasical.h"
QT_BEGIN_NAMESPACE
namespace Ui { class DialogHeatGraph2DSettings; };
QT_END_NAMESPACE

class QTableWidget;

namespace pst
{
    class DataHeatGraph2DSettings;

    class DialogHeatGraph2DSettings : public IdaDialogFrame
    {
        Q_OBJECT

    public:
        DialogHeatGraph2DSettings(QWidget* parent = nullptr);
        ~DialogHeatGraph2DSettings();

        void setWindowUniversalID(int windowUniversalID);

        void initWidget();

        void initData(DataHeatGraph2DSettings* dataHeatGraph2DSettings);

        void ChangeCurrentWidget(int index);
        void setCurveInfoID(int curveInfoID) { m_curveInfoID = curveInfoID; };
        int getCurveInfoID() const { return m_curveInfoID; };

    signals:
        void signal_sendData(int windowUniversalID, int curveInfoID, Info2DPointer info = nullptr);
        void signal_titleRename();

    private slots:

        void reject() override;

        void accept() override;

        bool slot_apply();


    private:
        QTableWidget* initData_colorBar();
        QTableWidget* initData_xAxisDisplay();
        QTableWidget* initData_xAxisRange();
        QTableWidget* initData_yAxisDisplay();
        QTableWidget* initData_yAxisRange();
        QTableWidget* initData_grid();
        QTableWidget* initData_title();

        void saveUIData_colorBar();
        void saveUIData_xAxisDisplay();
        void saveUIData_xAxisRange();
        void saveUIData_yAxisDisplay();
        void saveUIData_yAxisRange();
        void saveUIData_grid();
        void saveUIData_title();

        void updateUIData_colorBar();
        void updateUIData_xAxisDisplay();
        void updateUIData_xAxisRange();
        void updateUIData_yAxisDisplay();
        void updateUIData_yAxisRange();
        void updateUIData_grid();
        void updateUIData_title();

    private:
        int m_windowUniversalID;
        int m_curveInfoID{-1};
        Ui::DialogHeatGraph2DSettings* ui;
        DataHeatGraph2DSettings* m_dataHeatGraph2DSettings;
        QTableWidget* m_tableWidget_colorBar;
        QTableWidget* m_tableWidget_xAxisDisplay;
        QTableWidget* m_tableWidget_xAxisRange;
        QTableWidget* m_tableWidget_yAxisDisplay;
        QTableWidget* m_tableWidget_yAxisRange;
        QTableWidget* m_tableWidget_grid;
        QTableWidget* m_tableWidget_title;
    };
}
#endif //PST_DIALOGGRAPH2DSETTINGS_H
